Skip to content

feat(octavia): add project quota monitoring - #161

Open
Jeremy Lee (legit-ninja) wants to merge 3 commits into
vexxhost:mainfrom
samaritanark:contrib/octavia-quotas-2b3
Open

Jeremy Lee (legit-ninja) wants to merge 3 commits into
vexxhost:mainfrom
samaritanark:contrib/octavia-quotas-2b3

Conversation

@legit-ninja

@legit-ninja Jeremy Lee (legit-ninja) commented Dec 2, 2026 •

Copy link
Copy Markdown

Summary

Add project quota monitoring for the seven Octavia quota resources: load balancers, listeners, pools, members, health monitors, L7 policies and L7 rules.

This also adds the shared quota configuration (--quota.defaults-file) that the Cinder (#162), Manila (#163) and Neutron (#164) quota PRs extend.

Metrics

  • openstack_loadbalancer_quota_{loadbalancer,listener,pool,member,healthmonitor,l7policy,l7rule}: gauges with tenant, tenant_id, domain_id and type labels, where type is limit or in_use. No reserved values are emitted.
  • openstack_loadbalancer_quota_up: unlabeled gauge, 1 when quota collection succeeds (including an empty database), 0 when it fails. Absent when Octavia is disabled. Separate from the existing openstack_loadbalancer_up inventory health.

Behavior

  • Limits come from the quotas table. An explicit project value wins; a NULL or missing override uses the configured default. Zero and -1 are preserved.
  • in_use is recounted from the object tables with Octavia's check_quota_met predicate: the object's own project and provisioning_status != 'DELETED'. ERROR and pending objects count. These counts can differ from Octavia's cached in_use_* counters, which Octavia enforces against.
  • Projects come from quota rows, usage and Keystone (via --keystone.database-url), so idle and usage-only projects are reported. Without Keystone metadata, the project ID is used as tenant and domain_id is empty.
  • Both quota reads must succeed before any quota sample is emitted. On failure, the collector logs the operation and an error classification (not the raw driver message), emits quota_up=0 and no quota samples, and leaves other metrics and the HTTP scrape intact.

Configuration

  • --quota.defaults-file / QUOTA_DEFAULTS_FILE (optional): JSON with an octavia section holding all seven defaults. Without it, the exporter logs a warning and assumes Octavia 2025.2's unlimited (-1) defaults. A supplied file that is unreadable, malformed or incomplete fails startup when Octavia is enabled; it is ignored when Octavia is disabled.
  • --octavia.quota-query-timeout / OCTAVIA_QUOTA_QUERY_TIMEOUT (default 5s): shared deadline for the two quota reads. Set it below the scrape timeout.

Dependencies

Requires QuotaRepository from [vexxhost/openstackdb#11](vexxhost/openstackdb#11). go.mod needs bumping to an openstackdb release that includes it before CI can build this PR.

Performance

The usage recount scans all seven Octavia object tables, which have no index on project_id or provisioning_status. Check query plans and latency on a representative database before enabling it on large deployments.

Tests

  • Unit tests for defaults parsing and validation, limit precedence, usage, project fallback, failure handling and timeouts (stable under -race).
  • Startup tests for configuration errors.
  • End-to-end coverage of all seven resources with nullable and explicit limits, deleted objects and an idle project.

Built and tested (go build, go vet, go test -race ./...) against openstackdb with #11 applied. MariaDB end-to-end tests have not yet been run against the rebased dependency

Export stored limits and rebuilt usage for seven Octavia resources, with
project metadata fallback, defaults configuration, bounded SQL reads and
separate quota health. Preserve inventory and other service registration.

Requires the public openstackdb quota APIs; keep the canonical dependency
until those APIs are accepted upstream. Validate through an external Go
workspace in the meantime.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
Extend the existing full-exporter fixture with distinct resource counts,
nullable and explicit limits, deleted resources and an idle project.
Assert every quota family and preserve existing service assertions.

Integration-tag vet passes; native MariaDB execution is pending because
Docker is unavailable in the preparation environment.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
Signed-off-by: David Hulick <dave.hulick@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants